package com.speedchina.permission.web.sys;

import com.speedchina.framework.base.BaseController;
import com.speedchina.framework.base.QueryModel;
import com.speedchina.framework.model.R;
import com.speedchina.permission.aspect.SysLog;
import com.speedchina.permission.base.i18n.I18nService;
import com.speedchina.permission.domain.sys.dto.LogOperationDTO;
import com.speedchina.permission.domain.sys.entity.LogOperation;
import com.speedchina.permission.domain.sys.po.LogOperationPo;
import com.speedchina.permission.service.sys.LogOperationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 操作日志接口
 *
 * @author Winter
 * @date 2021-05-11 08:41:36
 */
@RestController
@RequestMapping("/sys/logOperation")
@Api(description = "操作日志接口")
public class LogOperationController extends BaseController<LogOperationService, LogOperation, LogOperationDTO> {

    @Autowired
    private I18nService i18nService;

    @Autowired
    private LogOperationService service;

    @ApiOperation("操作日志-分页查询")
    @GetMapping
//    @SysLog("操作日志-分页查询")
    // @RequiresPermissions("sys:logOperation:list")
    public R query(Integer pageNo, Integer pageSize, LogOperationPo params) {
        return R.page(service.queryPage(new QueryModel<>(pageNo, pageSize, params)));
    }

    @ApiOperation("操作日志-详情查询")
    @GetMapping("/get")
//    @SysLog("操作日志-详情查询")
    // @RequiresPermissions("sys:logOperation:info")
    public R get(LogOperationPo params) {
        return R.data(service.get(params));
    }

    @ApiOperation("操作日志-批量删除")
    @DeleteMapping("/{ids}")
    @SysLog("操作日志-批量删除")
    // @RequiresPermissions("sys:logOperation:delete")
    public R delete(@PathVariable("ids") String strIds) {
        return R.data(this.deleteBatch(strIds));
    }

}
